/**
 * 项目名称: LCR_123.cpp
 * 项目路径: study/DataStructure/LinkedList/LeetCode/剑指Offer
 * 编辑时间: 2024年06月27日21时59分05秒
 * 用   户: 轻尘
 */

#include <bits/stdc++.h>

using namespace std;

struct ListNode {
    int val;
    ListNode *next;

    ListNode() : val(0), next(nullptr) {}

    ListNode(int x) : val(x), next(nullptr) {}

    ListNode(int x, ListNode *next) : val(x), next(next) {}
};

class Solution {
public:
    vector<int> reverseBookList(ListNode *head) {
        vector<int> result;
        ListNode *per = nullptr, *cpu = head, *tmp = nullptr;
        while (cpu) {
            tmp = cpu->next;
            cpu->next = per;
            per = cpu;
            cpu = tmp;
        }
        delete cpu, tmp;
        for (ListNode *p = per; p != nullptr; p = p->next) {
            result.push_back(p->val);
        }
        return result;
    }
};

int main() {

    return 0;
}
